global.Page = function(args) {

    const defaultShareEvent = {
        title: '邀请您参加肿瘤防治健康跑',
        path: '/pages/index/index',
    }

    const newArgs = Object.assign({}, args)

    // 复制微信号
    newArgs.toCopyWxId = function(res) {
        console.log("复制微信号");

        wx.setClipboardData({
            data: 'omnivoreplan',
            success(res) {
                wx.showToast({
                    title: '客服微信号已复制，去加他为好友吧！',
                    icon: 'none',
                    duration: 4000
                });
            }
        })
    }
    newArgs.onShareAppMessage = function(res) {
        if (args.onShareAppMessage) {
            const pageConfig = args.onShareAppMessage.call(this, res)

            // let path = pageConfig.path || defaultShareEvent.path

            // if(path.indexOf('?') === -1) {
            //     path += '?'
            // }else {
            //     path += '&'
            // }

            // path += 'unionid=' + store.get().unionid

            // const d = {
            //     title: pageConfig.title || defaultShareEvent.title,
            //     path
            // }

            return pageConfig
        } else {
            return Object.assign({}, defaultShareEvent)
        }
    }

    Page(newArgs)
}